package demo4grails

import example.Manufacturer
import grails.boot.GrailsApp
import grails.boot.config.GrailsAutoConfiguration
import groovy.transform.CompileStatic
import org.springframework.boot.ApplicationArguments
import org.springframework.boot.ApplicationRunner

@CompileStatic
class Application extends GrailsAutoConfiguration implements ApplicationRunner {
    static void main(String[] args) {
        GrailsApp.run(Application, args)
    }

    @Override
    void run(ApplicationArguments args) throws Exception {
        Manufacturer.withTransaction {
            Manufacturer.saveAll(
                    new Manufacturer(name: 'Audi'),
                    new Manufacturer(name: 'Ford')
            )
        }
    }
}